import React ,{ComponentType,PropsWithChildren} from 'react'
import {Navigate} from "react-router-dom"
const Hoc_login = (Com:ComponentType<object>) => {
  return (props:PropsWithChildren<object>) => {
    const token = window.localStorage.getItem('token');
    if (!token) {
       return <Navigate to={"/login"}></Navigate>
    }
    return <Com {...props}/>
  }
}

export default Hoc_login